﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfSnqkGasAnalysis.IData;
using WpfSnqkGasAnalysis.Model;

namespace WpfSnqkGasAnalysis.IData_impl
{
    /// <summary>
    /// 数据接口实现；
    /// </summary>
    public class Water_check_historyDAL_impl : BaseDAL, IWater_check_historyDAL
    {
        public List<Water_check_history> GetList(long waterPointId)
        {
            string sql = " select  *   from  Water_check_history where waterPointId=" + waterPointId;
            return ExecSqlCmd(sql, null, c =>
             {
                 var reader = c.ExecuteReader();
                 if (!reader.HasRows)
                 {
                     return null;
                 }
                 List<Water_check_history> list = new List<Water_check_history>();
                 while (reader.Read())
                 {
                     Water_check_history his = new Water_check_history();
                     his.Id = (long)reader["id"].ToMyInt64();
                     his.Check_user_name = reader["Check_user_name"].ToString();
                     his.Check_user_id = (long)reader["Check_user_id"].ToMyInt64();
                     his.Check_time = reader["Check_time"].ToString();
                     his.Check_stat = (byte)reader["Check_stat"].ToMyInt64();
                     his.Reject_reason = reader["Reject_reason"].ToString();
                     his.WaterPointId = (long)reader["WaterPointId"].ToMyInt64();
                     list.Add(his);
                 }
                 return list;
             });

        }
    }
}
